package com.budwk.app.sqfw.enums;

import cn.hutool.json.JSONUtil;
import lombok.Getter;

import java.util.List;

/**
 * @author XYD-PC021
 * @project dfxy-shequ
 * @description
 * @date 2024/1/8 15:01:09
 */
@Getter
public enum WeiQingMenPdfType {
    TRAFFIC_EMERGENCY_INSPECTION(20,"2,9", "【交通应急巡查台账】合集","PDF"),
    THREE_IN_ONE_INSPECTION(21,"10", "【三合一应急巡查台账】合集","PDF"),
    EMERGENCY_INSPECTION(22,"1,3,4,5,6,7,8", "【应急巡查台账】合集","PDF"),
    SAFETY_INVESTIGATE_RENOVATE(23,"1,2,3,4,5,6,7,8,9,10,11,12,13,14", "【安全排查整治表】合集","PDF"),
    FIRE_SAFETY_IN_CATERING_ESTABLISHMENTS(24,"11,12", "【餐饮经营服务场所消防安全巡查台账】合集","PDF"),
    BOTTLED_GAS_USER_SAFETY_MANAGEMENT(25,"13", "【瓶装燃气用户安全管理巡查台账】合集","PDF"),
    WORK_SAFETY_RECTIFICATION_NOTICE(26,"14", "【重点场所隐患巡查台账】合集","PDF");

    private final Integer code;
    private final String index;
    private final String name;
    private final String type;

    WeiQingMenPdfType(Integer code, String index, String name,String type) {
        this.code = code;
        this.index = index;
        this.name = name;
        this.type = type;
    }

    /**
     * 通过index获取登录客户端类型
     *
     * @param code
     * @return
     */
    public static String getName(Integer code) {
        for (WeiQingMenPdfType o : WeiQingMenPdfType.values()) {
            if (o.getCode() == code) {
                return o.getName();
            }
        }
        return null;
    }

    public static List<Integer> getIdx(Integer code) {
        for (WeiQingMenPdfType o : WeiQingMenPdfType.values()) {
            if (o.getCode() == code) {
                String index = o.getIndex();
                String idx[] = index.split(",");
                List<Integer> integers = JSONUtil.toList(JSONUtil.parseArray(idx), Integer.class);
                return integers;
            }
        }
        return null;
    }
}
